package com.sctvcloud.renhe.ui.adapter.holder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.ruihang.generalibrary.ui.util.OnItemInternalClick;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.renhe.R;
import com.sctvcloud.renhe.beans.FCityState;
import com.sctvcloud.renhe.ui.utils.GlideCircleTransform;
import com.sctvcloud.renhe.ui.utils.GlideUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ChooseCityHolder extends BaseRecylerHolder<FCityState> implements View.OnClickListener {

    @BindView(R.id.city_name)
    protected CustomFontTextView cityName;
    private FCityState cityState;
    private OnItemInternalClick onItemInternalClick;

    public OnItemInternalClick getOnItemInternalClick() {
        return onItemInternalClick;
    }

    public void setOnItemInternalClick(OnItemInternalClick onItemInternalClick) {
        this.onItemInternalClick = onItemInternalClick;
    }

    public ChooseCityHolder(Context context, View itemView) {
        super(context, itemView);
        itemView.setOnClickListener(this);
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(FCityState state) {
        this.cityState = state;
        cityName.setText(state.getCityName());
    }

    @Override
    public void onClick(View v) {
        if (internalClick != null) {
            itemView.setTag(R.id.adapter_item_data_key, cityState);
            internalClick.onItemInternalClick(itemView, v, getAdapterPosition());
        }
    }

}
